#ifndef ENIGMAWINDOW_H
#define ENIGMAWINDOW_H

#include <QMainWindow>
#include <QString>
#include "enigma.h"
#include "rotor.h"

QT_BEGIN_NAMESPACE
namespace Ui { class EnigmaWindow; }
QT_END_NAMESPACE

class EnigmaWindow : public QMainWindow
{
    Q_OBJECT

public:
    EnigmaWindow(QWidget *parent = nullptr);
    ~EnigmaWindow();

protected:
    void keyPressEvent(QKeyEvent *env);
    void keyReleaseEvent(QKeyEvent *env);

private slots:
    void on_resetBtn_clicked();
    void on_startBtn_clicked();
    void on_startChars_textChanged(const QString &arg1);
    void on_plugboardPairs_textChanged(const QString &arg1);

private:
    void highlightLetter(char ch);
    void clearHighlight();

private:
    Ui::EnigmaWindow *ui;
    QString startChars;
    QString plugboardPirs;
    QString inputText, outputText;
    bool working, letterPressed;

    Enigma *m_enigmaMachine;
};
#endif // ENIGMAWINDOW_H
